<template>
  <div :class="prefixCls">
    <Badge :count="msgCount" dot :offset="[-6, 0]" @click="handleShowMsg">
      <BellOutlined />
    </Badge>
    <MsgModal @register="registerModal" />
  </div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Badge } from 'ant-design-vue';
import { BellOutlined } from '@ant-design/icons-vue';
import { myMsg } from '/@/api/sys/sysNoticeManage';
import { useDesign } from '/@/hooks/web/useDesign';
import MsgModal from './MsgModal.vue';
import { useModal } from '/@/components/Modal';
import { useUserStoreWithOut } from '/@/store/modules/user';
const { prefixCls } = useDesign('header-notify');
const [registerModal, { openModal }] = useModal();
const msgCount = ref(0);
const userStore = useUserStoreWithOut();
const token = userStore.getToken;

// var timer = setInterval(() => {
//   debugger;
//   if (token) {
//     myMsg({ status: 0 }).then((res) => {
//       msgCount.value = res.rows.length;
//     });
//   }
// }, 1000  * 5);

function handleShowMsg() {
  openModal(true, {});
}
</script>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-header-notify';

.@{prefix-cls} {

  &__overlay {
    max-width: 360px;
  }

  .ant-tabs-content {
    width: 300px;
  }

  .ant-badge {
    font-size: 18px;

    .ant-badge-multiple-words {
      padding: 0 4px;
    }

    svg {
      width: 0.9em;
    }
  }
}
</style>
